//
//$Id: generate.h 630 2011-01-27 17:40:06Z andrew.tsyganov $
#include "contrib/rapidxml/rapidxml.hpp"
#include "src/heo/include/random.h"
#include "fa.h"
#include "re.h"

const std::string kGenerateXmlNode                  = "generate";
const std::string kGenerateXmlGeneratorNode         = "generator";
const std::string kGenerateXmlFALeslieNode          = "fa_leslie";
const std::string kGenerateXmlSeedNode              = "seed";
const std::string kGenerateXmlSampleSizeNode        = "sample_size";
const std::string kGenerateXmlSymbolsNumNode        = "symbols_num";
const std::string kGenerateXmlStatesNumNode         = "states_num";
const std::string kGenerateXmlInitialNumNode        = "initial_num";
const std::string kGenerateXmlFinalNumNode          = "final_num";
const std::string kGenerateXmlTransitionDensityNode = "transition_density";
const std::string kGenerateXmlTypeNode              = "type";
const std::string kGenerateXmlInequivalentNode      = "inequivalent";

const std::string kGenerateXmlFNamePfxNode          = "fname_pfx";

const std::string kGenerateXmlFALadybirdNode        = "fa_ladybird";
const std::string kGenerateXmlStatesMinNode         = "states_min";
const std::string kGenerateXmlStatesMaxNode         = "states_max";


class FA_Leslie_Parameters
{
public:
	std::string fname_pfx_;
	u_t seed_;
	u_t sample_size_;
	u_t symbols_num_;
	u_t states_num_;
    u_t initial_num_;
	u_t final_num_;
	double transition_density_;
	std::string type_;
	bool inequivalent_;

	FA_Leslie_Parameters() { init_Default(); };
	void init_Default()
	{
		fname_pfx_          = "leslie";
		seed_               = 100;
		sample_size_        = 100;
		symbols_num_        = 2;
		states_num_         = 5;
		initial_num_        = 1;
		final_num_          = 2;
		transition_density_ = 0.2;
		type_               = "nfa";
		inequivalent_       = false;
	}
	bool load_XML(std::string const& file);
};


class FA_Ladybird_Parameters
{
public:
	std::string fname_pfx_;
	u_t states_min_;
	u_t states_max_;

	FA_Ladybird_Parameters() { init_Default(); };
	FA_Ladybird_Parameters(std::string const& file);
	void init_Default()
	{
		fname_pfx_  = "ladybird";
		states_min_ = 3; 
		states_min_ = 20; 
	}
	bool load_XML(std::string const& file);
};


class Generate
{
public:
	std::string generator_;
	FA_Leslie_Parameters fa_lep_;
	FA_Ladybird_Parameters fa_lbp_;

	Generate() { init_Default(); };
	void init_Default()
	{
		generator_ = "fa_leslie";
		fa_lep_.init_Default();
		fa_lbp_.init_Default();
	}
	bool load_XML(std::string const& file);
	void run(std::string const& dir) const;
};

void GenerateFALeslie(std::string const& dir, FA_Leslie_Parameters const& fa_lep);
void GenerateFALadybird(std::string const& dir, FA_Ladybird_Parameters const& fa_lbp);
void FALeslie(FA& fa, FA_Leslie_Parameters const& fa_lep, random_generator& rnd);

//EOF!
